/*
 * Licensed by the Bunie Developmentgroup
 */

package Protocol;

import java.util.ArrayList;

/**
 * QueryResponsePacket for the managementqueries
 * @author Patrick Wobben
 * @version v0.95
 * @since v0.95 (20-5-2012)
 */
public class QueryResponsePacket extends BasicPacket{
    private String query;
    public int queryResult = 0;
    public int queryId;
    private String queryName;
    public final static int QUERYSUCCES = 1;
    public final static int QUERYFAILED = -1;
    private ArrayList<String[]> queryInformation;
    
    /**
     * Constructor for the inlogrequestpacket
     *
     * @param version Version of this inlogresponsepacket
     */
    public QueryResponsePacket(int version) {
        super(version);
        this.type = PacketTypeKeeper.QUERYRESPONSEPACKET;
    }
    
    /**
     * Methode to set the status of the queryresult that this is a response to
     *
     * @param queryResult value to set
     */
    public void setQueryResult(int queryResult) {
        this.queryResult = queryResult;
    }
    
    /**
     * Methode to get the status of queryresult that this is a response to
     *
     * @return QueryResult value
     */
    public int getQueryResult() {
        return this.queryResult;
    }
    
    /**
     * Methode to get the id of the query
     * @return
     */
    public int getQueryId(){
        return this.queryId;
    }
    
    /**
     * Methode to get the query
     * @return 
     */
    public String getQuery(){
        return this.query;
    }
    
    /**
     * Methode to get the name of the query
     * @return 
     */
    public String getQueryName(){
        return this.queryName;
    }
    
    @Override
    public int getType() {
        return this.type;
    }
    
    
    @Override
    public String toString() {
        return super.toString() + " "+
               "query result: "+queryResult  +" "+
               "id of the query: "+queryId + "  "+
               "name of the query "+queryName;
    }

    /**
     * @return the queryInformation
     */
    public ArrayList<String[]> getListWithAccounts() {
        return queryInformation;
    }

    /**
     * Methode to set the iquery information
     * @param queryInformation 
     */
    public void setListWithAccounts(ArrayList<String[]> queryInformation) {
        this.queryInformation = queryInformation;
    }
}